package com.seveneight.baijiesteward.ui.main.presenter;

import android.content.Context;

import com.alibaba.fastjson.JSONObject;
import com.seveneight.baijiesteward.bean.AnyBean;
import com.seveneight.baijiesteward.http.MyCallBack;
import com.seveneight.baijiesteward.ui.main.contract.ForgetPwdContract;
import com.seveneight.baijiesteward.ui.main.model.ForgetPwdModel;

import okhttp3.RequestBody;

/**
 * Created by user1 on 2018/2/24.
 */

public class ForgetPwdPresenter implements ForgetPwdContract.ForgetPwdPresenter {

    ForgetPwdContract.ForgetPwdView forgetPwdView;
    ForgetPwdContract.ForgetPwdModel forgetPwdModel;

    public ForgetPwdPresenter(ForgetPwdContract.ForgetPwdView forgetPwdView) {
        this.forgetPwdView = forgetPwdView;
        forgetPwdModel = new ForgetPwdModel();
    }

    @Override
    public void getCode(Context context, RequestBody body) {
        forgetPwdModel.getCode(context, body, new MyCallBack<AnyBean>() {
            @Override
            public void onSuccess(AnyBean s) {
                forgetPwdView.rebackCode();
            }

            @Override
            public void onFailed() {

            }
        });
    }

    @Override
    public void changeLoginPwd(Context context, RequestBody body) {
        forgetPwdModel.changeLoginPwd(context, body, new MyCallBack<AnyBean>() {
            @Override
            public void onSuccess(AnyBean s) {
                forgetPwdView.rebackLoginPwd();
            }

            @Override
            public void onFailed() {

            }
        });
    }

    @Override
    public void changeTradePwd(Context context, RequestBody body) {
        forgetPwdModel.changeTradePwd(context, body, new MyCallBack<AnyBean>() {
            @Override
            public void onSuccess(AnyBean s) {
                forgetPwdView.rebackTradePwd();
            }

            @Override
            public void onFailed() {

            }
        });
    }
}
